package com.sardine.base.esm.session.defaults;

import com.sardine.base.esm.executor.EsmExecutor;
import com.sardine.base.esm.session.Configuration;
import com.sardine.base.esm.session.EsmSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.List;

/**
 * 上海京东到家元信信息技术有限公司<br>
 * Created with IntelliJ IDEA.
 * Date:2017/5/22
 * Time:12:07
 *
 * @author daifeng<br>
 *         daifeng@imdada.cn
 * @since JDK 1.7 <br>
 * Copyright (c) 2017 imdada System Incorporated All Rights Reserved.
 */
public class DefaultEsmSession implements EsmSession {
    private static final Logger logger = LoggerFactory.getLogger(DefaultEsmSession.class);
    private Configuration configuration;
    private EsmExecutor executor;

    public DefaultEsmSession(Configuration configuration, EsmExecutor executor) {
        this.configuration = configuration;
        this.executor = executor;
    }

    @Override
    public <T> T selectOne(String statement) {
        return null;
    }

    @Override
    public <E> List<E> selectList(String statement) {
        return null;
    }

    @Override
    public int insert(String statement) {
        return 0;
    }

    @Override
    public int update(String statement) {
        return 0;
    }

    @Override
    public int delete(String statement) {
        return 0;
    }

    /**
     * Closes this stream and releases any system resources associated
     * with it. If the stream is already closed then invoking this
     * method has no effect.
     *
     * @throws IOException if an I/O error occurs
     */
    @Override
    public void close() throws IOException {

    }

    /**
     * 获取类的映射
     *
     * @param type
     * @return
     */
    @Override
    public <T> T getMapper(Class<T> type) {
        return configuration.<T>getMapper(type,this);
    }

    /**
     * 得到ESM 相关配置信息
     *
     * @return
     */
    @Override
    public Configuration getConfiguration() {
        return configuration;
    }
}
